#!/usr/bin/ruby
# -*- ruby -*-
#
# http://www.reddit.com/r/dailyprogrammer/comments/19mn2d/030413_challenge_121_easy_bytelandian_exchange_1/

H = {}

def r(i)
  unless H[i]
    v = (i == 0) ? 1 : r(i / 2) + r(i / 3) + r(i / 4)

    H[i] = v
  end

  return H[i]
end

ARGV.each do |i|
  puts "#{i} => #{r(i.to_i)}"
end
